const HTMLWebpackPlugin = require("html-webpack-plugin");
const path = require("path");

module.exports = {
  entry: "./src/main.js",
  output: {
    filename: "[name]-[contenthash].bundle.js",
    path: path.join(__dirname, "dist"),
  },
  mode: "none",
  devtool: false,
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env", { modules: false }],
          },
        },
      },
      {
        test: /\.js$/,
        exclude: /node_modules/,
        use: ["eslint-loader"],
        enforce: "pre",
      },
      {
        test: /\.less$/,
        use: ["style-loader", "css-loader", "sass-loader"],
      },
      {
        test: /\.(png|jpe?g|gif|ico)$/,
        use: {
          loader: "url-loader",
          options: {
            limit: 10 * 1024,
          },
        },
      },
      {
        test: /\.vue$/,
        use: {
          loader: "vue-loader",
        },
      },
    ],
  },
  plugins: [
    new HTMLWebpackPlugin({
      title: "vue-app-base-task",
      template: "./public/index.html",
    }),
  ],
};
